C_FLAGS=-Wall
C_DEBUG_FLAGS= $(C_FLAGS) -g
C_RELEASE_FLAGS= $(C_FLAGS) -O3
L_FLAGS=

SOURCES = main.cpp MiernikSkurczowego.cpp MiernikRozkurczowego.cpp
RELEASE_OBJECTS = $(SOURCES:.cpp=.o)
DEBUG_OBJECTS = $(addprefix dbg_,$(SOURCES:.cpp=.o))

all: release 

release: $(RELEASE_OBJECTS)
	g++ $^ -o $@ $(LFLAGS)

$(RELEASE_OBJECTS): %.o: %.cpp
	g++ -c $< -o $@ $(C_RELEASE_FLAGS)
	
debug: $(DEBUG_OBJECTS)
	g++ $^ -o $@ $(LFLAGS)

$(DEBUG_OBJECTS): dbg_%.o: %.cpp
	g++ -c $< -o $@ $(C_DEBUG_FLAGS)
	
clean:
	rm -f *.o *.exe

.PHONY: clean all